<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html class="no-js" lang="">
<head>
	<title>菜单管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<script type="text/javascript">
        $(document).ready(function() {
            $("#treeTable").treeTable({expandLevel : 3}).show();
        });
	</script>
</head>
<body>
	<header class="panel-heading no-b">
		<h5><b>菜单管理</b></h5>
	</header>
	<div class="panel-body">
		<div class="table-responsive">
			<form:form id="searchForm" action="${ctx}/sys/menu" method="post" class="form-inline" cssStyle="padding-bottom: 10px">
				<label><a href="${ctx}/sys/menu/form" class="btn btn-primary">新增菜单</a></label>
			</form:form>
			<sys:message content="${message}"/>
			<table id="treeTable" class="table table-striped table-bordered responsive no-m">
				<thead><tr><th>名称</th><th>链接</th><th>可见</th><th>权限标识</th><shiro:hasPermission name="sys:menu:edit"><th>操作</th></shiro:hasPermission></tr></thead>
				<tbody>
				<c:forEach items="${list}" var="menu">
					<tr id="${menu.id}" pId="${menu.parent.id ne '1'?menu.parent.id:'0'}">
						<td nowrap><a href="${ctx}/sys/menu/form?id=${menu.id}">${menu.name}</a></td>
						<td title="${menu.href}">${fns:abbr(menu.href,30)}</td>
						<td>${menu.isShow eq '1'?'显示':'隐藏'}</td>
						<td title="${menu.permission}">${fns:abbr(menu.permission,30)}</td>
						<shiro:hasPermission name="sys:menu:edit"><td nowrap>
							<a href="${ctx}/sys/menu/form?id=${menu.id}">修改</a>
							<a href="${ctx}/sys/menu/delete?id=${menu.id}" onclick="return confirmx('要删除该菜单及所有子菜单项吗？', this.href)">删除</a>
							<a href="${ctx}/sys/menu/form?parent.id=${menu.id}">添加下级菜单</a>
						</td></shiro:hasPermission>
					</tr>
				</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
</body>
</html>
